﻿<?=$this->load->view('include_header',null)?>
    <div id="top-panel">
        <div id="panel">
            <ul>
                <li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
                
            </ul>
        </div>
    </div>
    <div id="wrapper">
        <div id="content">
            <div id="box">
            <form id="form" method="POST" action="<?=site_url('archive/divorce_update/'.$cateid)?>">
            <fieldset>
            <legend>离婚证 Certificate of Divorce</legend>
            <label>持证人<br>Bearer of this certificate:</label><input type="text" name="full_name" value="<?=@$info->full_name?>" /> <br /> <br />
            <label>登记日期<br>Date of Registration:</label><input type="text" id="reg_date" name="reg_date" value="<?=@$info->reg_date?>" /> <br /><br />
            <label>离婚证字号<br>Certificate No:</label><input type="text" name="cert_no" value="<?=@$info->cert_no?>"/> <br />    <br />
            <label>备注<br>Note</label><input type="text" name="note" value="<?=@$info->note?>" style="width:400px" /> <br /> <br />
            <b>双方信息 Inforamtion</b> <hr size=1>
            <label>姓名<br>Full Name:</label><input type="text" name="name_1" value="<?=@$info->name_1?>" /> <br /> <br />
            <label>性别<br>Sex:</label>
            <select name="sex_1"/>
            <option value=1 <?if(@$info->sex_1 == 1) echo "selected"?>>男</option>
            <option value=2 <?if(@$info->sex_1 == 2) echo "selected"?>>女</option>
            </select> <br />  <br />
            <label>国籍<br>Nationality:</label><input type="text" id="nationality_1" name="nationality_1" value="<?=@$info->nationality_1?>" style="background:#FFFFC0; width:200px"/> <br />  <br />
            <label>出生日期<br>Date of Birth:</label><input type="text" id="birth_1" name="birth_1" value="<?=@$info->birth_1?>"/> <br />  <br />
            <label>身份证件号<br>National ID No:</label><input type="text" name="idcard_1" value="<?=@$info->idcard_1?>" style="width: 200px;"/> <br /><br />
            <label>姓名<br>Full Name:</label><input type="text" name="name_2" value="<?=@$info->name_2?>" /> <br /><br />
            <label>性别<br>Sex:</label>
            <select name="sex_2"/>
            <option value=1 <?if(@$info->sex_2 == 1) echo "selected"?>>男</option>
            <option value=2 <?if(@$info->sex_2 == 2) echo "selected"?>>女</option>
            </select> <br />  <br />
            <label>国籍<br>Nationality:</label><input type="text" id="nationality_2" name="nationality_2" value="<?=@$info->nationality_2?>" style="background:#FFFFC0; width:200px"/> <br /><br />
            <label>出生日期<br>Date of Birth:</label><input type="text" id="birth_2" name="birth_2" value="<?=@$info->birth_2?>"/> <br />  <br />
            <label>身份证件号<br>National ID No:</label><input type="text" name="idcard_2" value="<?=@$info->idcard_2?>" style="width: 200px;"/> <br />  <br />          
            <input type="hidden" name="id" value="<?=$id?>" />
            <input id="button1" type="submit" value="提交信息 Continue" onclick="return check_date_rules()"/>
            <input id="button2" type="reset" value="重置 Cancel" />
            </fieldset>
            </form>
            </div>

        </div>
        
        <script type="text/javascript" src="js/jquery.autocomplete.pack.js"></script>
        <link type="text/css" rel="stylesheet" href="css/jquery.autocomplete.css"/>
        
        <?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
    </div>

    <script type="text/javascript">
    function check_date_rules() {
        if(convert_to_date($('#reg_date').val()).getTime() >  new Date().getTime()) {
            alert('[登记日期]不能大于[当前日期]！');
            return false;
        }   
        if(convert_to_date($('#birth_1').val()).getTime() > new Date().getTime()) {
            $('#birth1').focus();
            alert('[出生日期]不能大于[当前日期]！'); 
            return false;
        }        
        if(convert_to_date($('#birth_2').val()).getTime() > new Date().getTime()) {
            $('#birth2').focus();    
            alert('[出生日期]不能大于[当前日期]！');
            return false;
        }           
        return true; 
    }
    
    $().ready(function() {
      $("#form").validate({
        rules: {
            full_name:{
             required:true
            },
            employer_name:{
             required:true
            },
            employer_address:{
             required:true
            },
            income:{
             required:true
            }
        }
      });

    $.datepicker.setDefaults(
            {
            dateFormat: 'dd/mm/yy',
            readOnly: false
            }
        );
          
        $( "#reg_date" ).datepicker({
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true

        });
        $( "#birth_1" ).datepicker({
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true

        });
        $( "#birth_2" ).datepicker({
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true

        });
        
        $("#nationality_1").autocomplete("<?=base_url()?>user/quick_search_country", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']' + '['+ arr[4] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[4];
            }
        });
        
        $("#nationality_2").autocomplete("<?=base_url()?>user/quick_search_country", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']' + '['+ arr[4] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[4];
            }
        });  
      
    });
    </script>
    
<?=$this->load->view('include_footer',null)?>
